import { Confirm } from './../../../components/common-components/confirm';
import { MessageBoxService } from './../../../components/messageBox/messageBoxService';
import { ConfirmMessageResult } from './../../../components/messageBox/confirmMessage';
import { Terminal } from './../../../models/terminal';
import { LocalstorageDataManage } from './../../../common/localstoreage/localstoreageDataManage';
import { Component, OnInit } from '@angular/core';

@Component({
    templateUrl: './reset.component.html',
    styleUrls: ['./reset.component.scss']
})

export class ResetComponent implements OnInit {
    private terminal: Terminal;
    private LDCConfig;
    private terminalIp;

    ngOnInit() {
        this.terminal = LocalstorageDataManage.current.getTerminal();
        this.LDCConfig = LocalstorageDataManage.current.getLDCConfig();

        let device = (<any>window).device && (<any>window).device.getDeviceInfo() ||{"ppi":96,"hardware":"Gigabyte Technology Co., Ltd. To be filled by O.E.M.","deviceType":"desktop","deviceId":"FC:AA:14:BF:5D:23","platform":"Windows","platformVersion":"6.1.7601","os":"Microsoft Windows 7 旗舰版  Service Pack 1 64-bit","appShell":"menpuji WindowsAPP 2.12.0 building 20161031","appVersion":"2.12.0","ldcVersion":"","ip":"172.16.255.129"};
        this.terminalIp = device.ip;

        console.log('teminal,', this.terminal)
        console.log('LDCConfig,', this.LDCConfig)

    }

    async reset() {
        const result = await MessageBoxService.current.Show("重置终端", "确认重置终端？");
        if (result == ConfirmMessageResult.Ok) {
            localStorage.clear();
            location.reload();
        }
    }
}